<template>
  <div style="height: 600px">
    <el-table
        :data="list" border style="width: 100%" max-height="500">
      <el-table-column type="index" width="50">
      </el-table-column>
      <el-table-column prop="username" label="学生名" width="100">
      </el-table-column>
      <el-table-column prop="phone" label="电话" width="180">
      </el-table-column>
      <el-table-column prop="email" label="邮箱" width="180">
      </el-table-column>
      <el-table-column prop="begin_time" label="开始时间" width="180">
      </el-table-column>
      <el-table-column prop="end_time" label="截止时间" width="180">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import {IP} from "@/config";
import axios from "axios";
import moment from "moment";
export default {
  name: "TeacherGetRoom",
  data(){
    return{
      list:[],
      info:{}
    }
  },
  mounted() {
    this.info = JSON.parse(sessionStorage.getItem("info"))
    let url = IP + "appointment/teaGetRoom"
    axios.post(url,{id:this.info.id}).then(res=>{
      this.list = res.data.data.stuList
      this.list.forEach((item,index)=>{
        let begin = this.list[index]["begin_time"]
        let end = this.list[index]["end_time"]
        this.list[index]["begin_time"] = moment(begin).format("YYYY-MM-DD HH:mm:ss");
        this.list[index]["end_time"] = moment(end).format("YYYY-MM-DD HH:mm:ss");
      })
      console.log(res)
    }).catch(error=>{
      console.log(error)
    })
  }
}
</script>

<style scoped>

</style>